package bizlogic;

import java.util.ArrayList;

import dao.*;
import model.*;

public class User {

	private EmployeeDAO user;

	public User() {
		user = DAOfactory.loadInstance().getEmployeeDAO();
	}
	
	public EmployeeDTO Authenticate(String UserName, String Password) throws DAOException{
		EmployeeDTO currentUser = user.FindEmployeeByUserPass(UserName, Password);
		return currentUser; 
		
	}
	
	@SuppressWarnings("finally")
	public ArrayList<EmployeeDTO> findByManager(int userID){
		ArrayList<EmployeeDTO> employees = new ArrayList<EmployeeDTO>();
		try {
			employees = user.findEmployeeByManager(userID);
		} catch (DAOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally
		{
			return employees;
		}
		
	}
	
}